package com.ruoyi.system.service.impl;

import com.ruoyi.system.domain.SysDataSource;
import com.ruoyi.system.mapper.SysDataSourceMapper;
import com.ruoyi.system.service.ISysDataSourceService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class SysDataSourceServiceImpl implements ISysDataSourceService {


    private static final Logger log = LoggerFactory.getLogger(SysDataSourceServiceImpl.class);
    @Autowired
    private SysDataSourceMapper sysDataSourceMapper;

    /**
     * @param dataSourceId
     * @return
     */
    @Override
    public SysDataSource getById(Long dataSourceId) {
        log.info("数据源信息："+sysDataSourceMapper.getById(dataSourceId));
        return sysDataSourceMapper.getById(dataSourceId);
    }

    /**
     * 数据数据库名称获取数据库连接信息
     *
     * @param dbName
     * @return
     */
    @Override
    public SysDataSource getDBByDBName(String dbName) {
        return sysDataSourceMapper.getDBByDBName(dbName);
    }
}
